/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * MasterFormBairro.java
 *
 * Created on 22/12/2012, 14:12:00
 */
package inovacao.gui;

import inovacao.interfaces.MasterForm;
import inovacao.modelos.CustomizadoTextField;
import java.awt.Component;
import java.util.ArrayList;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTable;
import javax.swing.JTextField;

/**
 *
 * @author Giovani
 */
public class MasterFormCidade extends JPanel implements MasterForm {

    /** Creates new form MasterFormBairro */
    private JTable jTable;
    public MasterFormCidade(JTable jTable) {
        super();
        this.jTable = jTable;
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")    
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jLabelCod = new javax.swing.JLabel();
        jTextCod = new CustomizadoTextField(4, jTable, 0);
        jLabelDesc = new javax.swing.JLabel();
        jTextDesc = new CustomizadoTextField(20, this.jTable, 1);

        setBorder(javax.swing.BorderFactory.createEtchedBorder());
        setAutoscrolls(true);

        jLabelCod.setLabelFor(jTextCod);
        jLabelCod.setText("Código");
        jLabelCod.setToolTipText("Código do bairro");

        jLabelDesc.setLabelFor(jTextDesc);
        jLabelDesc.setText("Descrição");

        jTextDesc.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTextDescActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(37, 37, 37)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabelDesc)
                    .addComponent(jLabelCod))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jTextDesc, javax.swing.GroupLayout.PREFERRED_SIZE, 180, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jTextCod, javax.swing.GroupLayout.PREFERRED_SIZE, 76, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(235, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jTextCod, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabelCod))
                .addGap(8, 8, 8)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jTextDesc, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabelDesc))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(26, 26, 26)
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(32, Short.MAX_VALUE))
        );
    }// </editor-fold>//GEN-END:initComponents

private void jTextDescActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextDescActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jTextDescActionPerformed
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel jLabelCod;
    private javax.swing.JLabel jLabelDesc;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JTextField jTextCod;
    private javax.swing.JTextField jTextDesc;
    // End of variables declaration//GEN-END:variables

    public JLabel getjLabelCod() {
        return jLabelCod;
    }
    
    public void setjLabelCod(JLabel jLabelCod) {
        this.jLabelCod = jLabelCod;
    }
    
    public JLabel getjLabelDesc() {
        return jLabelDesc;
    }
    
    public void setjLabelDesc(JLabel jLabelDesc) {
        this.jLabelDesc = jLabelDesc;
    }
    
    public JPanel getjPanel1() {
        return jPanel1;
    }
    
    public void setjPanel1(JPanel jPanel1) {
        this.jPanel1 = jPanel1;
    }
    
    public JTextField getjTextCod() {
        return jTextCod;
    }
    
    public void setjTextCod(JTextField jTextCod) {
        this.jTextCod = jTextCod;
    }
    
    public JTextField getjTextDesc() {
        return jTextDesc;
    }
    
    public void setjTextDesc(JTextField jTextDesc) {
        this.jTextDesc = jTextDesc;
    }
    
    @Override
    public ArrayList<Component> allComponentes() {
        ArrayList<Component> componentes = new ArrayList<Component>();
        componentes.add(getjTextCod());
        componentes.add(getjTextDesc());
        return componentes;        
    }
}
